import jieba
import wordcloud
import imageio
import sqlite3


con = sqlite3.connect('movie.db')
cur = con.cursor()
sql = "select duanping from movietop250"
text = ''
data = cur.execute(sql)
for item in data:
    text = text+item[0]
mk = imageio.imread("123.png")
w = wordcloud.WordCloud(width=1000,
                        height=700,
                        collocations=False,
                        background_color='white',
                        font_path='msyh.ttc',
                        mask=mk,
                        # stopwords=exclude,
                        max_words=150,
                        scale=15)
txtlist = jieba.cut(text)
string = " ".join(txtlist)
w.generate(string)
w.to_file('static/images/ciyun.png')
print('生成完毕')